import 'dart:convert';

class WorksBoxModel {
  WorksBoxModel({
    this.title,
    this.totalCount,
    this.basePrice,
    this.thumb,
  });

  String? title;
  String? totalCount;
  String? basePrice;
  String? thumb;

  factory WorksBoxModel.fromRawJson(String str) =>
      WorksBoxModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory WorksBoxModel.fromJson(Map<String, dynamic> json) => WorksBoxModel(
        title: json["title"] == null ? null : json["title"],
        totalCount: json["total_count"] == null ? null : json["total_count"],
        basePrice: json["base_price"] == null ? null : json["base_price"],
        thumb: json["thumb"] == null ? null : json["thumb"],
      );

  Map<String, dynamic> toJson() => {
        "title": title == null ? null : title,
        "total_count": totalCount == null ? null : totalCount,
        "base_price": basePrice == null ? null : basePrice,
        "thumb": thumb == null ? null : thumb,
      };
}

//盲盒详情
class BoxInfoModel {
  BoxInfoModel({
    this.info,
    this.specialBlindBoxList,
    this.specialBlindBoxLog,
    this.shouMemberList,
  });

  Info? info;
  List<SpecialBlindBoxList>? specialBlindBoxList;
  List<SpecialBlindBoxLog>? specialBlindBoxLog;
  List<ShouMemberList>? shouMemberList;

  factory BoxInfoModel.fromRawJson(String str) =>
      BoxInfoModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory BoxInfoModel.fromJson(Map<String, dynamic> json) => BoxInfoModel(
        info: json["info"] == null ? null : Info.fromJson(json["info"]),
        specialBlindBoxList: json["special_blind_box_list"] == null
            ? null
            : List<SpecialBlindBoxList>.from(json["special_blind_box_list"]
                .map((x) => SpecialBlindBoxList.fromJson(x))),
        specialBlindBoxLog: json["special_blind_box_log"] == null
            ? null
            : List<SpecialBlindBoxLog>.from(json["special_blind_box_log"]
                .map((x) => SpecialBlindBoxLog.fromJson(x))),
        shouMemberList: json["shou_member_list"] == null
            ? null
            : List<ShouMemberList>.from(json["shou_member_list"]
                .map((x) => ShouMemberList.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "info": info == null ? null : info!.toJson(),
        "special_blind_box_list": specialBlindBoxList == null
            ? null
            : List<dynamic>.from(specialBlindBoxList!.map((x) => x.toJson())),
        "special_blind_box_log": specialBlindBoxLog == null
            ? null
            : List<dynamic>.from(specialBlindBoxLog!.map((x) => x.toJson())),
        "shou_member_list": shouMemberList == null
            ? null
            : List<dynamic>.from(shouMemberList!.map((x) => x.toJson())),
      };
}

class Info {
  Info(
      {this.id,
      this.thumb,
      this.title,
      this.portrait,
      this.nickname,
      this.contractAddress,
      this.framerAccountAddress,
      this.introduce,
      this.brandIntroduction,
      this.detail,
      this.castPrice,
      this.basePrice,
      this.framerMemberId,
      this.story,
      this.saleCount,
      this.allCount,
      this.num,
      this.sellTime,
      this.specialTypeName,
      this.isPresell,
      this.second,
      this.code,
      this.chain_mark,
      this.create_time});

  int? id;
  String? thumb;
  String? title;
  String? portrait;
  String? nickname;
  String? contractAddress;
  String? framerAccountAddress;
  String? introduce;
  String? brandIntroduction;
  String? framerMemberId;
  String? detail;
  String? castPrice;
  String? basePrice;
  String? story;
  int? saleCount;
  int? allCount;
  int? num;
  String? sellTime;
  String? specialTypeName;
  int? isPresell;
  int? second;
  String? code;
  String? chain_mark;
  String? create_time;

  factory Info.fromRawJson(String str) => Info.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Info.fromJson(Map<String, dynamic> json) => Info(
        id: json["id"] == null ? null : json["id"],
        thumb: json["thumb"] == null ? null : json["thumb"],
        title: json["title"] == null ? null : json["title"],
        portrait: json["portrait"] == null ? null : json["portrait"],
        nickname: json["nickname"] == null ? null : json["nickname"],
        framerMemberId: json["framer_member_id"] == null
            ? null
            : json["framer_member_id"].toString(),
        contractAddress:
            json["contract_address"] == null ? null : json["contract_address"],
        framerAccountAddress: json["framer_account_address"] == null
            ? null
            : json["framer_account_address"],
        introduce: json["introduce"] == null ? null : json["introduce"],
        brandIntroduction: json["brand_introduction"] == null
            ? null
            : json["brand_introduction"],
        detail: json["detail"] == null ? null : json["detail"],
        castPrice: json["cast_price"] == null ? null : json["cast_price"],
        basePrice: json["base_price"] == null ? null : json["base_price"],
        story: json["story"] == null ? null : json["story"],
        saleCount: json["sale_count"] == null ? null : json["sale_count"],
        allCount: json["all_count"] == null ? null : json["all_count"],
        num: json["num"] == null ? null : json["num"],
        sellTime: json["sell_time"] == null ? null : json["sell_time"],
        specialTypeName: json["special_type_name"] == null
            ? null
            : json["special_type_name"].toString(),
        isPresell: json["isPresell"] == null ? 0 : json["isPresell"],
        second: json["second"] == null ? 0 : json["second"],
        code: json["code"] == null ? null : json["code"],
        chain_mark: json["chain_mark"] == null ? null : json["chain_mark"],
        create_time: json["create_time"] == null ? null : json["create_time"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "thumb": thumb == null ? null : thumb,
        "title": title == null ? null : title,
        "portrait": portrait == null ? null : portrait,
        "nickname": nickname == null ? null : nickname,
        "framer_member_id": framerMemberId == null ? null : framerMemberId,
        "contract_address": contractAddress == null ? null : contractAddress,
        "framer_account_address":
            framerAccountAddress == null ? null : framerAccountAddress,
        "introduce": introduce == null ? null : introduce,
        "brand_introduction":
            brandIntroduction == null ? null : brandIntroduction,
        "detail": detail == null ? null : detail,
        "cast_price": castPrice == null ? null : castPrice,
        "base_price": basePrice == null ? null : basePrice,
        "story": story == null ? null : story,
        "sale_count": saleCount == null ? null : saleCount,
        "special_type_name": specialTypeName == null ? null : specialTypeName,
        "num": num == null ? null : num,
        "sell_time": sellTime == null ? null : sellTime,
        "all_count": allCount == null ? null : allCount,
        "isPresell": isPresell == null ? 0 : isPresell,
        "second": second == null ? 0 : second,
        "code": code == null ? null : code,
        "chain_mark": chain_mark == null ? null : chain_mark,
        "create_time": create_time == null ? null : create_time,
      };
}

class ShouMemberList {
  ShouMemberList({
    this.nickname,
    this.portrait,
  });

  String? nickname;
  String? portrait;

  factory ShouMemberList.fromRawJson(String str) =>
      ShouMemberList.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ShouMemberList.fromJson(Map<String, dynamic> json) => ShouMemberList(
        nickname: json["nickname"] == null ? null : json["nickname"],
        portrait: json["portrait"] == null ? null : json["portrait"],
      );

  Map<String, dynamic> toJson() => {
        "nickname": nickname == null ? null : nickname,
        "portrait": portrait == null ? null : portrait,
      };
}

class SpecialBlindBoxList {
  SpecialBlindBoxList({
    this.id,
    this.title,
    this.probability,
    this.basePrice,
  });

  int? id;
  String? title;
  String? probability;
  String? basePrice;

  factory SpecialBlindBoxList.fromRawJson(String str) =>
      SpecialBlindBoxList.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory SpecialBlindBoxList.fromJson(Map<String, dynamic> json) =>
      SpecialBlindBoxList(
        id: json["id"] == null ? null : json["id"],
        title: json["title"] == null ? null : json["title"],
        probability: json["probability"] == null ? null : json["probability"],
        basePrice: json["base_price"] == null ? null : json["base_price"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "title": title == null ? null : title,
        "probability": probability == null ? null : probability,
        "base_price": basePrice == null ? null : basePrice,
      };
}

class SpecialBlindBoxLog {
  SpecialBlindBoxLog({
    this.nickname,
    this.createTime,
    this.content,
    this.title,
  });

  String? nickname;
  String? createTime;
  String? content;
  String? title;

  factory SpecialBlindBoxLog.fromRawJson(String str) =>
      SpecialBlindBoxLog.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory SpecialBlindBoxLog.fromJson(Map<String, dynamic> json) =>
      SpecialBlindBoxLog(
        nickname: json["nickname"] == null ? null : json["nickname"],
        createTime: json["create_time"] == null ? null : json["create_time"],
        content: json["content"] == null ? null : json["content"],
        title: json["title"] == null ? null : json["title"],
      );

  Map<String, dynamic> toJson() => {
        "nickname": nickname == null ? null : nickname,
        "create_time": createTime == null ? null : createTime,
        "content": content == null ? null : content,
        "title": title == null ? null : title,
      };
}

class GoodsMangModel {
  GoodsMangModel({
    this.ordersn,
    this.orderId,
    this.goodsId,
  });

  String? ordersn;
  String? orderId;
  String? goodsId;

  factory GoodsMangModel.fromRawJson(String str) =>
      GoodsMangModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory GoodsMangModel.fromJson(Map<String, dynamic> json) => GoodsMangModel(
        ordersn: json["ordersn"] == null ? null : json["ordersn"],
        orderId: json["order_id"] == null ? null : json["order_id"],
        goodsId: json["goodsId"] == null ? null : json["goodsId"],
      );

  Map<String, dynamic> toJson() => {
        "ordersn": ordersn == null ? null : ordersn,
        "order_id": orderId == null ? null : orderId,
        "goodsId": goodsId == null ? null : goodsId,
      };
}

class OpenBoxModel {
  OpenBoxModel({
    this.id,
    this.title,
    this.saleCount,
    this.totalCount,
    this.basePrice,
    this.thumb,
  });

  String? id;
  String? title;
  String? saleCount;
  String? totalCount;
  String? basePrice;
  String? thumb;

  factory OpenBoxModel.fromRawJson(String str) =>
      OpenBoxModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory OpenBoxModel.fromJson(Map<String, dynamic> json) => OpenBoxModel(
        id: json["id"] == null ? null : json["id"].toString(),
        title: json["title"] == null ? null : json["title"].toString(),
        saleCount:
            json["sale_count"] == null ? null : json["sale_count"].toString(),
        totalCount:
            json["total_count"] == null ? null : json["total_count"].toString(),
        basePrice:
            json["base_price"] == null ? null : json["base_price"].toString(),
        thumb: json["thumb"] == null ? null : json["thumb"].toString(),
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "title": title == null ? null : title,
        "sale_count": saleCount == null ? null : saleCount,
        "total_count": totalCount == null ? null : totalCount,
        "base_price": basePrice == null ? null : basePrice,
        "thumb": thumb == null ? null : thumb,
      };
}

class InviteInfoModel {
  InviteInfoModel({
    this.list,
    this.userNum,
    this.package,
    this.detail,
    this.status,
    this.img,
    this.url,
    this.rule,
  });

  List<ListElement>? list;
  int? userNum;
  int? package;
  String? detail;
  bool? status;
  String? img;
  String? url;
  List<Rule>? rule;

  factory InviteInfoModel.fromRawJson(String str) =>
      InviteInfoModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory InviteInfoModel.fromJson(Map<String, dynamic> json) =>
      InviteInfoModel(
        list: json["list"] == null
            ? null
            : List<ListElement>.from(
                json["list"].map((x) => ListElement.fromJson(x))),
        userNum: json["userNum"] == null ? null : json["userNum"],
        package: json["package"] == null ? null : json["package"],
        detail: json["detail"] == null ? null : json["detail"],
        status: json["status"] == null ? null : json["status"],
        img: json["img"] == null ? null : json["img"],
        url: json["url"] == null ? null : json["url"],
        rule: json["rule"] == null
            ? null
            : List<Rule>.from(json["rule"].map((x) => Rule.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "list": list == null
            ? null
            : List<dynamic>.from(list!.map((x) => x.toJson())),
        "userNum": userNum == null ? null : userNum,
        "package": package == null ? null : package,
        "detail": detail == null ? null : detail,
        "status": status == null ? null : status,
        "img": img == null ? null : img,
        "url": url == null ? null : url,
        "rule": rule == null
            ? null
            : List<dynamic>.from(rule!.map((x) => x.toJson())),
      };
}

class ListElement {
  ListElement({
    this.id,
    this.img,
    this.title,
    this.tag,
  });

  String? id;
  String? img;
  String? title;
  String? tag;

  factory ListElement.fromRawJson(String str) =>
      ListElement.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory ListElement.fromJson(Map<String, dynamic> json) => ListElement(
        id: json["id"] == null ? null : json["id"],
        img: json["img"] == null ? null : json["img"],
        title: json["title"] == null ? null : json["title"],
        tag: json["tag"] == null ? null : json["tag"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "img": img == null ? null : img,
        "title": title == null ? null : title,
        "tag": tag == null ? null : tag,
      };
}

class Rule {
  Rule({
    this.numberStart,
    this.numberEnd,
    this.title,
    this.num,
    this.status,
    this.nousednum
  });

  int? numberStart;
  int? numberEnd;
  String? title;
  String? num;
  int? status;
  int? nousednum;

  factory Rule.fromRawJson(String str) => Rule.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Rule.fromJson(Map<String, dynamic> json) => Rule(
        numberStart: json["number_start"] == null ? null : json["number_start"],
        numberEnd: json["number_end"] == null ? null : json["number_end"],
        title: json["title"] == null ? null : json["title"],
        num: json["num"] == null ? null : json["num"].toString(),
        status: json["status"] == null ? null : json["status"],
        nousednum: json["nousednum"] == null ? null : json["nousednum"],

      );

  Map<String, dynamic> toJson() => {
        "number_start": numberStart == null ? null : numberStart,
        "number_end": numberEnd == null ? null : numberEnd,
        "title": title == null ? null : title,
        "num": num == null ? null : num,
        "status": status == null ? null : status,
        "nousednum": nousednum == null ? null : nousednum,
      };
}

class InviteUserList {
  InviteUserList({
    this.id,
    this.mobile,
    this.createTime,
    this.portrait,
    this.url,
    this.title,
    this.package,
    this.real_name_status
  });

  int? id;
  String? mobile;
  String? createTime;
  String? portrait;
  String? url;
  String? title;
  int? package;
  int? real_name_status;

  factory InviteUserList.fromRawJson(String str) =>
      InviteUserList.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory InviteUserList.fromJson(Map<String, dynamic> json) => InviteUserList(
        id: json["id"] == null ? null : json["id"],
        mobile: json["mobile"] == null ? null : json["mobile"].toString(),
        createTime:
            json["create_time"] == null ? null : json["create_time"].toString(),
        portrait: json["portrait"] == null ? null : json["portrait"].toString(),
        url: json["url"] == null ? null : json["url"].toString(),
        title: json["title"] == null ? null : json["title"].toString(),
        package: json["package"] == null ? null : json["package"],
        real_name_status: json["real_name_status"] == null ? null : json["real_name_status"],
      );

  Map<String, dynamic> toJson() => {
        "id": id == null ? null : id,
        "mobile": mobile == null ? null : mobile,
        "create_time": createTime == null ? null : createTime,
        "portrait": portrait == null ? null : portrait,
        "url": url == null ? null : url,
        "title": title == null ? null : title,
        "package": package == null ? null : package,
        "real_name_status": real_name_status == null ? null : real_name_status,
      };
}
